<template>
  <div>
    <div>减法运算</div>
    {{ $store.getters.change }}
    <!-- 访问数据时必须按此方法访问不然不显示 -->
    <div>数字:{{ $store.state.a.num }}</div>
    <div>原始的{{ $store.state.b.name }}</div>
    <button @click="sub">-1</button>
    <button @click="asyncsub">异步-2</button>
  </div>
</template>

<script>
export default {
  methods: {
    sub() {
      this.$store.commit('suba', 1)
    },
    asyncsub() {
      this.$store.dispatch('asyncsuba', 2)
    }
  }
}
</script>

<style lang="less" scoped></style>
